package com.zhenhao.xsq.ui.activity.user;

import android.os.Bundle;

import com.zhenhao.xsq.R;
import com.zhenhao.xsq.application.AppConfig;
import com.zhenhao.xsq.base.BaseActivity;
import com.zhenhao.xsq.ui.activity.user.component.DaggerUserAddComponent;
import com.zhenhao.xsq.ui.activity.user.contract.UserAddContract;
import com.zhenhao.xsq.ui.activity.user.module.UserAddModule;
import com.zhenhao.xsq.ui.activity.user.presenter.UserAddPresenter;
import com.zhenhao.xsq.utils.SpSaveUtils;

import javax.inject.Inject;

import androidx.annotation.Nullable;
import butterknife.ButterKnife;

//import com.yxld.yxchuangxin.xsq.utils.ImgUtil;

/**
 * @author xlei
 * @Package com.yxld.gb.xsq.ui.activity.user
 * @Description: $description
 * @date 2019/03/15 13:40:16
 */

public class UserAddActivity extends BaseActivity implements UserAddContract.View {

    private String TAG = "UserAddActivity";

    @Inject
    UserAddPresenter mPresenter;

    private int type;//1新增2编辑

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void initView() {
        setContentView(R.layout.activity_user_add);
        ButterKnife.bind(this);
        //        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        type = getIntent().getIntExtra("type", 1);
        if (type == 1) {
            setToolbarTitle("添加住户");
        } else {
            setToolbarTitle("编辑住户");
        }

    }

    @Override
    protected void initData() {
        if (type == 1) {
            //新增
        } else {
            //修改
        }
    }

    @Override
    protected void setupActivityComponent() {
        DaggerUserAddComponent
                .builder()
                .appComponent(((AppConfig) getApplication()).getApplicationComponent())
                .userAddModule(new UserAddModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void setPresenter(UserAddContract.UserAddContractPresenter presenter) {
        mPresenter = (UserAddPresenter) presenter;
    }

    @Override
    public void showProgressDialog() {
        progressDialog.show();
        progressDialog.setCancelable(false);
    }

    @Override
    public void closeProgressDialog() {
        progressDialog.hide();
    }



}